package com.apesource.bookBuy.mapper;

import com.apesource.bookBuy.bean.Admin;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @version 1.0
 * @auther:暮雪
 * @date:2025/9/4
 */
public interface AdminMapper {

    @Select("select * from admin where admin_name=#{adminName}")
    Admin findByAdminName(String adminName);

    @Select("select * from admin where admin_email=#{email}")
    Admin selectByEmail(String email);

    @Select(" select * from admin where admin_name=#{param1} and admin_pwd=#{param2}")
    Admin selectByAdminNameAndPwd(String adminName,  String adminPwd);


    @Insert("insert into admin(admin_email,admin_pwd,admin_name,admin_bir,admin_sex,admin_addr) values (#{adminEmail},#{adminPwd},#{adminName},#{adminBir},#{adminSex},#{adminAddr})")
    int insertAdmin(Admin admin);


    @Update("update admin set admin_email=#{adminEmail},admin_name=#{adminName},admin_bir=#{adminBir},admin_sex=#{adminSex},admin_addr=#{adminAddr} where admin_id=#{adminId}")
    int updateAdminInfo( Admin admin);

    @Update("update admin set admin_pwd=#{param2} where admin_id=#{param1}")
    int updateAdminPwd(int adminId, String adminPwd);

}
